require("@nomicfoundation/hardhat-toolbox");
require("@chainlink/env-enc").config();
const ProxyAgent = require("proxy-agent");

const SEPOLIA_URL = process.env.SEPOLIA_URL;
const SEPOLIA_ACCOUNTS_1 = process.env.PRIVATE_KEY_1;
const SEPOLIA_ACCOUNTS_2 = process.env.PRIVATE_KEY_2;
const ETHERSCAN_API_KEY_1 = process.env.ETHERSCAN_API_KEY_1;
const PROXY_URL = process.env.PROXY_URL; // 添加代理 URL

module.exports = {
    solidity: "0.8.27",
    networks: {
        sepolia: {
            url: SEPOLIA_URL,
            accounts: [SEPOLIA_ACCOUNTS_1, SEPOLIA_ACCOUNTS_2],
            timeout: 200000,
            httpHeaders: {
                "User-Agent": "Mozilla/5.0",
            },
            provider: () =>
                new ethers.providers.JsonRpcProvider({
                    url: SEPOLIA_URL,
                    agent: new ProxyAgent(PROXY_URL), // 使用代理
                }),
        },
        hardhat: {
            chainId: 1337,
        },
    },
    etherscan: {
        apiKey: ETHERSCAN_API_KEY_1,
    },
};
